package com.fairytask.ui.battle
{
	import com.fairytask.engine.GameStage;
	import com.fairytask.engine.components.button.Button;
	import com.jzonl.stage.battle.BattleEvent;
	import com.fairytask.ui.base.FrameUI;
	
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	/**
	 * 战斗跳过ui 
	 * @author xujh
	 * 
	 */
	public class SkipUI extends FrameUI
	{
		private static var _self	:SkipUI;
		
		public var skipBtn	:Button;	//跳过
		
		public static function getInstance():SkipUI
		{
			if(_self == null)
			{
				_self	=	new SkipUI();				
			}
			return _self;
		}
		
		public function SkipUI()
		{
			super();
		}
		
		/**
		 * 初始化界面 
		 * 
		 */
		override public function initGUI():void
		{
			addChild(skipBtn);
			skipBtn.addEventListener(MouseEvent.CLICK,onClick);
		}
		
		/**
		 * 点击跳过 
		 * @param event
		 * 
		 */
		private function onClick(event:MouseEvent):void
		{
			model.dispatchEvent(new BattleEvent(BattleEvent.BATTLE_SKIP));
		}
		
		/**
		 * 显示 
		 * @param space
		 * @param onshow
		 * 
		 */
		override public function show(space:String=LOADLAYER, onshow:Function=null):void
		{
			autoPos = false;
			super.show(space,onshow);
		}
		
		/**
		 * 场景变化改变位置 
		 * 
		 */
		override protected function stageReSize(evt:Event=null):void
		{
			this.x	=	initX + GameStage.mainLayer.x;
			this.y = 	initY + GameStage.mainLayer.y;
		}
	}
}